package com.qian.fmall.service.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ESClient {
    @Bean
    public RestHighLevelClient getClient()
    {
        HttpHost httpHost = new HttpHost("192.168.56.104",9200);
        RestClientBuilder clientBuilder = RestClient.builder(httpHost);
        RestHighLevelClient client = new RestHighLevelClient(clientBuilder);
        return client;
    }
    @Bean
    public ObjectMapper getMapper()
    {
        return new ObjectMapper();
    }
}
